Added code for task scheduler