First pass at pixel sorting port to node.js