introduce type to pass state info and use it