added the SPF refactoring from Hannes Gredler <hannes@gredler.at>: