touch ups to get ported code working