split navigation and item render from long function