Queries and csv export skeleton