Added monitor thread for long calculations