Add tests & docs. Rework directory layout.