finalize app
fix segfault
more code to cpp file
fix example