Changed the way DM is accessed, as per Constantine's suggestions.