Added documentation and made a cleanup