Change this source code to be more standard C++ and understandable.