Re-created logic for password verification