significant refactoring of marginal