implemented the most basic of pattern logic