for data query logic