Handle signals and use command line arguments