Refactored code for sign up page