password management refactoring