#516- Added message handling for error and successful messages.