merging in contributions from others and fixing tests