Created objective function, close #3