Minor tidy up, need to figure out what is going wrong