Refactoring C Code: Starting with an API