refactoring to MVC -> send exit function as a callback to separate controller from view