Partial implementation of HandshakeChallenge

And general improvements