First cut of ported code.