Adding documentation and tests