change statefile format, fix a bunch of bugs, 4x2 now works