Move state.js out. For #1877