Ported to 1.6.4.
Added missing files to 1.5.2 port.