Added special cases to calcNumTouching function
Added special cases to calcNumTouching function