Use a defined State record instead of anonymous tuple