refactoring. template render now sends headers. static files now served correctly based on mime type