MD closer to Freeman's implementation
MD closer to Freeman's implementation