Improved sample3 cpp source files