refactor code for clang++