Minor bugs fixed, some test files added.