Added unit tests and fixed typos