Simplified setting the objective function