use mdt and more effecient approach