Extract function.

convert() didn't fit on my screen anymore.