tiny changes, removed system("pause") for portability