Improved test and code.