Added some changes to the main behaviour of the application.