added conditional writing of full and state. state now have reference to the corresponding full record