Modified the model + algo