Added/fixed documentation
Applied minor refactorings