Add timeout.
Fixed bug with sending data.
Rename variables