same functional code with function calling