addad capability for specifying max image count for selection. minor api changes.