Added Exceptions and made a unit test for message