Doc updated and tests refactored