Reworked view engine stuff to be implemented as middleware.