added proper function calling