add reference to rainers original code
insert improvements by hauke to extract.jl