refactor the install part,  separate code as method