Further changes to problem2.c to remove unnecessary variables and code