cleaned up login and registration and error handling.