Updated main.c from github.com/elc1798