adding conversion of patterns to a unique function