[refactor] Move some code out of core/state.py, to sh_init.py