updated to using attribute for state