Cleaned up code a bit, but not fixed