final state commit (a bit messy)