Refactored S to C