Added more unit tests and polished raw mina encoder.