Refined the pin/unpin mechanism.