Moved factorial into scalar.c