Refactor out the view into its own class and add autotest for it