Improved the performance, the bottleneck code is now put into another
thread so it won't lag the editor.