Add tests.

Extract classes.