Clean up main

This moves both the GTP code and the CLI code into separate modules. It also fixes a few warnings.

Closes #34