Separate processing into its own file. See #319