Moved funcs from main.c to main.h