Added multithreading and improved some stuff. Added Output class