added command line arguments. Refactoring of application.