New database & sql query class + random fixes