Better 404 handling, consolidate page rendering into single function