added some more comments for clarity.