Add message model and some fixes