Refactor some reusable portions onto a separate package