refactored appstate/config modules