$generateElement method; <li>'s moved out of the if statetments as suggested. Ref rBS5cbf7df5a0c2d5ded2ae5addce6141f8ff0eb60b#inline-66