Added some new vars and did a bit of tidying up