UNSTABLE: adding to uistate global, and moved vars to main.js