Adding main loop etc.