Improved pinning functionality