Developement of general g-factors, copy and paste of the old function