Replace the mac logic