Break mac creation into its own function for easier testing.