Define function after Patchwork is included