Re-arranged some function declarations