better isfactory implementation