Modified factorial.js