Fixed MD-bug and added some other stuff