clean up photos query