make it work for either protocol