Refactoring, improve few tests