Refactored password storage