updated transposition logic