refactoring install method