Added logging and db