  We present a fast and portable re-implementation of Piskunov and Valenti's
optimal-extraction algorithm (Piskunov & Valenti, 2002} in C/C++ together with
full uncertainty propagation, improved cosmic-ray removal, and an optimal
background-subtraction algorithm. This re-implementation can be used with IRAF
and most existing data-reduction packages and leads to signal-to-noise ratios
close to the Poisson limit. The algorithm is very stable, operates on spectra
from a wide range of instruments (slit spectra and fibre feeds), and has been
extensively tested for VLT/UVES, ESO/CES, ESO/FEROS, NTT/EMMI, NOT/ALFOSC,
STELLA/SES, SSO/WiFeS, and finally, P60/SEDM-IFU data.
