rewrite main controller with moment and save time range to app state