Fixing up a ton of herp derpies

Man my code sucked back in the day. It probably still does actually.