Improved logic when handling midnight start/end times and instances that start and end at the same datetime; updated template comments