added pinning function