use for instead of while&shift