fleshing out the program based on comments