optimized query and visual stuff