Make deter an external and add a test.