Reorganize function declaration order
Inline variable declaration and initialization