Reworked main.c