some additional calculations
some fixes
some prepare for node_js