Modified base query