Some refactoring following rewriting of model.
Many compilation problems are left