Move MD function to Util file. Refs #6
Divide functions accros files. Fixes #6
Change error handling.