Merged build script from new-ui branch.