PLD: move query functions to new libs/data module