compiling state, but very likely not working
write chivector