qpad function. maxDist noted as DEPRECATED