changed list to set and minor cleanup