start of ssa refactor using state modnads(-ish)