cleaned up ThreadOps and put try-catch outside the loops that contains sleep