Added a 500 error.

Also changed a bunch of if statements to a switch statement.
Updating.

Templates aren't currently working, but I don't think I've
committed in a little bit, which isn't good. So here's a
commit!