added gnutls backend and moved backend code into new files