more small refactoring to c5 code