moved a lot of functions over to helper.c