You should probably put this display logic in another function, since you have it duplicated below.