Refactored some code, made the chart page take the chart start and end time from the chart's settings and possibly some other changes.