ADDED: fast factorial function