More updates to the tests
Added comments
Removed debug option from connection
Updated encoder to recover from panics and return the error instead
Added more comments
Fixed broken test