Updated canonical pattern code