move error handler to separate file and enhance markup