tidied up code ever so slightly.