Move DirectoryEncoder out into its own package