Extended protocol + fixed issues

Hi,
updated some code.