Added MSB/LSB conversion code and tests.