Moved dests related functions into dests.cc