refactored directory creation and package install