Outsourced leafscheduler
Minor changes