master thread sort of done,
merge, minor fixes