Unit testing in place

Move the implementation details into an impl file that's called by init
and used busted(http://olivinelabs.com/busted/#spies-mocks-stubs) for
unit testing the module. This will allow me to change the module with a
higher confidence.