why move the check up? other checks (range()) are after the getXxx() calls, it's a good idea to stick to the same layout