First stage of SET support completed.

More comprehensive tests and comments are missing. Furthermore, there
are still some TODOs to implement.