Moved the user functionality into its own file.