modularize all four shift algorithms