added documentation to code