Routes and rendering rework.

Rework the routes for upload/file access and errors.
Also rework the internal rendering. Make render_top() and
render_bottom() private functions. Call them in other pages rendering
functions.