Changed an additional scanf to fgets, and moved a getchar() to deal with newlines