port over code from old golytics