added support for factorials