Added views and func to handle 404 and 500 errors.