Refactor password prompting