Method set_value and its contracts implemented