Wire everything togethor in mainloop