Restructure JS and Add Test Coverage

IN PROGRESS.

See #55.
@zebulonj by the way I quite like the pattern of using 
```
define(function(require) {
  var $ = require('jquery');
}
```

It can get messy when a lot of modules have to be imported.