Changed output on a few error messages and condensed code a little