Return string instead of printing in patch