Refracetor: use function template for parsing