creating a mapping function (maps keyinputs to "actions)
small changes on node.js side