swapped order of when to print; it's better this way