Add documentation and minor code-refactoring

Redundant declaration