Minor tidy ups to the code