Refactor MD

closes pr #41