Adding message handling and database classes