This truthy check of "filter" could be moved to the outer "if" statement. No sense doing any conversion of chunk if there's no filter. I'll make this change.