made i global
formatting
extracted handleArgs()