Various refactoring + 1 bug fix

start time > end time should only check when same day
Revert "Various refactoring + 1 bug fix"

This reverts commit 011b4fb1a1a798d156d2949ba3d56309f4c9e214.
Recommit "Various refactoring + 1 bug fix"