added comments for readability