Refactored generate, link, and install scripts