refractoring s3