almost have refactor working completely, finally