modified query and cleaned table