Improve API to create scheduled tasks