Added test suite and small fixes.