tidied up some list subsetting code