Trying to make right cost function.