Revised to work with clang