add const magic to update states when needed