refactor controller to use $interval and change the orm to use string