Add tests + small fixes.