Refactor to pre-install