updated JS to run on node.js, move code for robot into a class, created common class