Refactor code

Move protocol constructor argument "shouldRetransmit" into "config"
object.
Change logger to log objects as parameters.
Add documentation to Protocol.