added check_next and some other assistant files