some more code from wet to dry with help from the musdasch