updated isPasswordValid