switched to using promises with $timeout