Cleaned up code... or at least tried to.