Added prototype for main cycle