added support for different protocol versions