fixed a silly bug; works, but surprisingly slow...