rewrite with my len version