doing the value function parts