Revised MPD function
Updated to current working copy