Used match to unpack tuple for easier to read code