Make getBucket more general.