Better DataBase, Logging and updated sql-gen