refactor router, add event-driven view managment