Cleanup and updates to scheduler.