moved the update_next_run from the end of the run to the beginning
changed logging level to error for schedule collisions
some formatting and comments to make the code clearer
added unit tests for new functionality