refactored code and started phantomJS tests which currently dont work well with the Mocha tests on the browser side only