Patch-2

Separating API, adding some TCP communication.