Add tests and fix typos