updated main.c sample