added length validation