analytics and code cleanup