Patched in changes from TDM