tidied code up for keyexpansion and shiftrows