added support for factorial