Small refctors, added error_tag, added some unit test for messages controller