Add and remove pins

What is it supposed to do in the end?