Clarifying code for self-loops