Smal doc imrpovement and unit tests