Cleaned up code and added NewUser function