clobbering this with code from e24bb73cbf. it all needs to be re-looked at, so might as well be something that runs (horribly unsync'd though)