Refactoring
Fix tests