tidied up comments and renamed variables