slow, but works
commented out threading for code diffs