Refactored code and added the user side of things.