Move substitution into its own file