added function arity checks
added 'this' variable
made factorial function anonymous