added some basic functions to implement client.
doesn't work yet