refactoring & s3 debug class