move schedule to config and add error handling