C refactored