cpp dir refactoring