Added threads supports [There are leaks =( and try-catch isn't working, but threads is working in other cases]