removed unused variables like $metrics_visits 

removed unused variables like $metrics_visits and $sort_visits