some cleanups - i think we're at a working version now