Moved initalization and command parser stuff out of mainloop