Divided the project into multiple files and removed redundant code from main.c.