Refactor complete

* Taking advantage of JS closures & CoffeeScript's script transformations to provide encapsulation.
Added tests for waypoint calculations