Cleaned up a few lines. Added more comments.