added documentation to code --Carlos