middle of big refactor