next last pattern func deleted due to errors