Cleaned the code

- jslinted everything
- used lab instead of mocha (because smaller)
- moved code to lib
- fixed a tiny