refactoring and basic 'security'