Minor code clean up only. Will continue cleaning up and add new features
for protocol 3.0.0 in this branch.