refactoring security groups