adding functionality to define time and be able to close the application