Added ability to handle jagged maps