Password gen refactory.