changed c++ like object constructor to js like