Refactor and fix static file serving.