Refactor C module