implement handshake prototype

Can you separate these if conditions?