statfi function from sorvi moved in here