tidy up + comment code