refactor package instal functions.