working scheduler, needs more error handling