better check if message was sent
Little cleanup
Throw more specific exceptions when an error occurs