[minor] cleanup variable names and simplified precedence check