added some more comments for explaining