added a few comments for readability