Refactored AWS s3 handler, add logging