tweaks to functionality and improvements to test coverage
fix to over nested array