Moved code from main.cc into lumail.{cc h}

  This neatens our structure, and simplifies the main.cc file.

  This closes #104