porting from FAEA (thx Dr-Shado)