Cleaned the code up a little, added some more comments.