fixes #31; fixes to csw discovery and other improvements