fixed and improved getNextUpcomingTask. also improved overall code quality of Schedule