Add comments and more unit tests