switching to a function to do the final render to simplify future code.