refac HQuery