refactored the template and build generation