update pin fucntion