better implementation for findOutputSection