Huge refactoring start debugging...