Cast to long.
Fixed time range on update and basic cleanup; still needs more cleanup.
Potential fix for chart rendering and updating issues when device goes to sleep for long durations of time; still testing.
Merge remote-tracking branch 'origin/wip/cookie' into wip/cookie