Reduce size by reordering variable declarations

Close gh-1421