start of big refactor