Added documentation and tests