1. refactoring the code to take into account content with times are in different days