Move some var declarations for clarity