Might you want to throw AssertionError() here and make explicit the zero-content cases, to make sure you dont' end up visiting elements you dont' think you should handle?