added optimization for row shifting