Minor changes. Improved testing.