Reformat code, remove count from loop, add htmlspecialchars() to more text