Reading state and writes it back