#8 - Refactored how start and end dates are retrieved to build the query