Refactor code for some CLANG errors