Convert to NodeJS + simplify structure