Direct port from Java model code. WIP