Fixed message logging, now uses two databases for better storage and lookups
Added debug logging message in logMessage