reworked to lift the rendering logic out into an object, improvement
enabled inline captions, fixes