Move validation statements for 'nx' and 'ny' further down