middle of big refactor
working, fast, pretty good, can do better