updated with more comments
updated documentation for each protocol function