Re-arranging code