Completed multi-threading and cleaned up code in general :)