updated val.pl to new state representation