Rework query and attribute