main.c bugfix and header comments