replaced $timeout with $interval