shapeII: refactor and abstract some things away