Move (and reorder) declarations to avoid warnings triggered by -Wdeclaration-after-statement Closes #459