Added some testing functionality to catch the final bugs.  Moved the schedule check routine to the scheduler library, as the logic was rather encumbering. A couple of lines may be open to logical simplification... but this should work