password check modified and tested

Refactored password check