Created main loop & timing control