Only extract the extension once.

Relates to #22.