Refactoring and security