tidied/simplified misplaced directive detection