Changes to use of access tokens and a general tidy up