Re-arranged code