Building logic for turn restrictions