refactoring trade protocol, reformatting