Made serveErrorPage function separate