Fixed tests + partial changes
Complete refactor...