Add application class and minor changes in the code.