Refactored after fixing DE398