Latest changes + refactoring