This could be moved before the if and removed from the following lines.