changed table and db queries