Finished first working version of scheduler