Move state outside of selection.js