reworked scheduler to be more sane