factorial modification