adding debugging to verify speed; not robust