Created command and query functions to encapsulate all related logic
like db/sync for queries and profiling