[WIP] Add tests, fix interval and uptime calculation