Refactoring layout and partial rendering -- add event listeners