Project refactoring

main.c split into modules