refactor 'sets' and other minor things