refactoring for more generalized data sets instead of hard coded day and night