Adding better state data structure and configuration