First stage porting with complete test suite.

Signed-off-by: Toha <tohenk@yahoo.com>