re-order functions to fix compilation errors