Exercises 1 & 2. My exM function is really fast and tested.