Cleanup and DRYification of install script.