Refacotring
Fix tests