Refactor utils. Update mocha version in package json.