Major refactoring. new function prefix mdt_. changed string defines to static char's.