Updated setValue method