fixed major glitches, some more work remaining