cleanup bad formatting, and incorrect event handling.