Refactor to use message references/pointers instead of values.