documentation and small code improvement