Fixed a number of bugs in countNeighbors (R and C++). Updated tests for countNeighbors function.