From c to c++ and better code style