Optimisations in SecurityGroup code