Added 'switch' function for reversing endianness