Fix test app and add some comments