refactoring c