tidied up program.cpp