Moved oauth functionality into its own file