Comments added explaining code in example.cpp