Improved code and added uninstall functionality