Updated build script
moved createThread a bit