Added documentation (comments) and minor refactoring