added comments where needed