slight adjustments and added output_bucket