Made the reframeSections function better