finishes refactoring into its own package