updated error checking and phrase formatting