Moved some common code up to a PinCommand