fix, structural changes in 2d matrix code modules; phpdoc issues; minor changes and improvements