Add basic doc. Refactoring methods and tests. Work in progress...