Re-order code for readability