Implemented type inference for n-ary function call, fixes.
Added rigid type annotations.
Simplified code.