General and intense code refactoring