Restructure and reformat code

Changes:

   * Moved out related endpoints into their own files
   * Formatted code text-width to be <= 80 characters