Better handle quitting
Refactor out tetra/main