Fixed a ton of errors

Made it look nicer as well, separated some lines and vars and values.
Merge pull request #1552 from raginruffalo/patch-3

Fixed a ton of errors