move functions to helpers.c