more improved scanning functions