Removedd LWAPP option.
Moved DTLS stuff into a separate function.