Fix definePrivate
Refactor all queries