testing

Added test function to check operation
Refactored and a few errors fixed

Found that the cron library does not discard jobs once they have been
run. Need to find a method to deal with this.