Added unit tests using nodejs and some other minor improvemets