Some refactoring, added monitor support