cleaned up a couple of bits of messy code