C++ version, potentially better