edited the function to include return types and correct parameter passing