refact ... for offline rendering
same code, but something broken...