implementing a MUCH cleaner schedule middleware