added expand and shrink recognition