Change code language from c++ to c, move client functions from main