change code to use state level obj