refactoring and using continuations to find first non found position