Renamed appropriately, functions work

JavaScript and C++ code fixed
sortByKey renamed appropriately to sortByValue
files changed
cleanup