Split out input validation