Ported all legacy PHP code to Node.