Adding clean up function to the build system and correcting a mistake in the generation stage.