updated bucket lookup logic