first working version of pattern parameter