Refactored sd_rperfo.

A bit nicer to look at, and less code.
Merge pull request #5 from biot/master

Refactored sd_rperfo.