Has added some comments and has cleaned the code in demo application.