then modified. This still contains some ugly special casing for procedures in the security section, but I haven't found a nicer way so far.