sharing js between node.js and client; definitions cleanup