extract function with error
use sequence instead of list for 1st pass