Switched from C++ to JS - JS version works (see Browser/index.html)