Improve gtd functions.