Cleaned up code a bit. Late-night programming leads to weirdness.