Merged the d_type optimisation code; this is disabled by default, and can be enabled...