refactored, fixed tests for latest mocha