implements functions and fix iterator