Add LoopObserver subclass and simple test; refactor