make attachEventListeners function easier to read
change title formatting