make appstate more flexible by accepting string