Add structure handling plaintext

Tests still need to be adapted to it.