Updated with changes from dmd's library