Improve variable definition ordering. Because it stops this file being a huge mess obviously...