- Cleanup and rewrite some mainloop code