Refactor add function to create scratch package.