Fixing bugs, adding tests suite with Mocha and Expect.js