Refactored code for sending new password