porting first function and test