Code documentation and small fix