Why was the Mayflower Compact Written?

The Mayflower Compact was written so that the pilgrims in America would have laws! They didn’t settle where the King had wanted them to, so they concluded that they didn’t need to follow his laws either and created their own. I bet the King was unhappy!