Scheduler Improvements

* Add a locking mechanism to prevent multiple schedulers running at once
* Optimize clean up scheduler
* Add time limit to scheduler runs