added a bunch of comments to clear things up