added tests and fixed typos