Refactored code a bit.
Make SFA usable with testdata.