New tests, fixed bugs.