Moved functions into chronological order.