Update: refactor in main.c