Refactored some code, added support for users.