Implement BETWEEN() function to tidy code