added range check to init()
moved C++ code into cpp directory