Refactored data uri generation.