cleaned up mainloop