Add porting files
Refactoring code