Updated mad stuff to work for more efficient stuff.