adding type checking on function calls