Added better logging and updated db