rewrote queries for rename