Rim and Hub query cleanup