Added docs and cosmetic cleanup