Optimized query count for displaying single test.
Removed obsolete code.