Added error messages and refactor login and sign up