Refactor sign up logic.