Tidying up code to remove old commented out stuff from earlier versions