Updated docs; small refactoring; added test