Add unit tests
Address comments