Introducing mocha, some tests and minor fixes