implement monitor thread