[Improved] Multi-threading is more standards-compliant now (thanks @Th69). Oh, and I did some code formatting.