small refactoring
improve tests