added getMessages from database