moved some functions to new aux.c