Clean up "wrap" function in HTML serializer