Added type checking to function calls