completed patternModel and test