Added string length checks