added documentation and removed excess comments