Please Read

optimisation for traingdm function is built however not tested,
adjustments have been made for parts of the code, which require an
integer argument for the number of layers.