Updated and made some fixes to protocol