Adding some code to version3.cpp