moving more stuff to swg.js