Cleaning up , minimizing queries