analytics and misc cleanup