working on pattern matcher