This logic belongs to the previous code block