updated password generation method