Finished basic protocol logic