Ported more code to D.