Fixed a few glaring flaws.