Porting code from sourceforge