Correctly order lines for script