Removed very inefficient query.
Added some logging for performance testing.