I ported the whole routine, but the code didnt work, again.

I think I am doing something wrong when porting routines...