Cleaned up code, lots of unnecessary stuff removed.