Made memory into class supporting 16bit access
Made tests more robust to endianness