add support for msp extraction, refactored a little bit...