Added error handling + password is now hashed