Added this function to keep the code DRY.