Modify previous commit to move restriction code into the UI.