Refactor the pin watcher.