move internal implementation into its own package