Factored out conversion into its own class