added code in Main for scheduler