Added check on input length