Improve separation of view and controller