Improved code for sections order