working on a minimal traversing function