Split the implementation of findTwin.