Refactoring
Fixed tests and test files
Main implementation