refactored the thread and method monitor