replace printStack with log, many repeated literals as const, one array copy with System copy