Converting to use $timeout and $interval

Improve mocking and testing ability