refactor and simplify the way view switching/rerendering works
new callbacks: viewRender, viewDestroy
new callback: eventDestroy
test file for new callbacks