Cleaned it up a bit, added a few comments. Done.