Hoist input check outside loop

Signed-off-by: Daniel Farina <daniel@heroku.com>