Clean up index.js, fix failing unit test.

index.js
  -Clean up code (remove debugging statements, etc).

test/index.js
  -Fix offset-distance test, which wasn't modified to reflect 23b12ad.