Initial c++ version of k2 for pop
Final C++ version of k2 for pop