Made a first pass at the scheduler