Refactor installing functions