Added another way to calculate the pattern.