add caching; random pins if unspecified