make P5shift more robust
implement global variables