Add more error detection; Add tests; fix typos in readme