added setType function to State - type is a string