Refactor some event handlers
merge bryan and derek's html changes