State variables as constant function symbols + improved/fixed flags