improved generateFromSet, minor changes