Updated content to cover more cases; updated C++ and Matlab specs.