refactoring monitor code out of tail.py