This code is very similar to the ```handshake``` method. Probably worths to refactor.