Refined changes to db for logging