Upgradle and overhaul build script