added documentation to the protocols; fixed some bottlenecks