updated build script optimized some code