Add messages and database connection. Changed to an async call mode