Added nearest pair code