Can you declare `var handler` at the top of this function for consistency?