Better logic in password recovert