Refactor how applications are built in scripts